<template>
  <div>
    <!-- 头部 -->
    <div class="head">
      <div class="row">
        <div class="title" @click="tohome">
          <a>{{ $t("Jiaxing Port Ship Information Sharing Platform") }}</a>
        </div>
      </div>
    </div>
    <div class="container">
      <div
        class="carousel"
        :style="{ backgroundImage: `url(${img.bj})` }"
      ></div>
    </div>
    <!-- 登录框 -->
    <div class="tk_login">
      <div class="lg_title">登录 Login</div>
      <div class="lg_tab">
        <span @click="setTabState(0)" :class="[tabstate == 0 ? 'xz' : '']"
          >{{$t("AccountLogin")}}</span
        >
        <span @click="setTabState(1)" :class="[tabstate == 1 ? 'xz' : '']"
          >{{$t("PhoneLogin")}}</span
        >
        <span v-show="tabstate == 2" class="xz">{{$t("Scan Code Login")}}</span>
      </div>
      <keep-alive>
          <component v-bind:is="currentTabComponent"></component>
      </keep-alive>
      <div class="lg_foot">
        <div @click="setTabState(tabstate == 2 ? 0 : 2)" class="triangle"></div>
        <a>{{$t("Other Login Methods")}}</a>
        <img :src="[tabstate != 2 ? img.ewm : img.dn]" />
      </div>
    </div>
  </div>
</template>
<script>
import { tab_1, tab_2 } from "@view/components/login";
export default {
  name: "login",
  components: {
    tab_1,
    tab_2,
  },
  data() {
    return {
      img: {
        bj: require("@/assets/imgs/1.png"),
        ewm: require("@/assets/imgs/ewm.png"),
        dn: require("@/assets/imgs/dn.png"),
      },
      tabstate: 0,
      currentTabComponent: tab_1,
    };
  },
  methods: {
    setTabState(state) {
      if (this.tabstate != state) {
        this.tabstate = state;
        if (state == 2) this.currentTabComponent = tab_2;
        else this.currentTabComponent = tab_1;
      }
    },
    login() {},
    tohome() {
      this.$router.push({ path: "/" });
    },
  },
};
</script>
<style lang="less" scoped>
@blue: #2d92ff;
@gray: #8a8a8a;
@i-tsize: 1.4rem;
@topheight: 10vh;
.head {
  position: fixed;
  z-index: 10;
  height: @topheight;
  line-height: @topheight;
  width: 100%;
  background: white;
}
.row {
  display: flex;
  justify-content: space-between;
  width: 100%;
  min-width: 600px;
}

.title {
  cursor: pointer;
  display: flex;
  margin-left: 30px;
  align-items: center;
  font-size: 1.5rem;
  color: @blue;
}
.container {
  padding-top: @topheight;
}
.carousel {
  width: 100%;
  height: calc(100vh - @topheight);
  background-repeat: no-repeat;
  background-size: 100% 100%;
}
.tk_login {
  position: absolute;
  right: 5vw;
  top: 17vh;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 12px;
  width: 48vh;
  box-shadow: 0px 8px 12px 0px rgba(109, 108, 108, 0.9);
}
.lg_title {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 9vh;
  width: 100%;
  color: @blue;
  font-size: 1.5rem;
}
.lg_tab {
  height: 6vh;
  width: 100%;
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  background: rgb(201, 225, 252);
  color: #7faadb;
  font-size: 0.9rem;
  opacity: 1;
  span {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
  }
}
.xz {
  color: @blue;
  font-weight: 600;
}
.lg_foot {
  position: relative;
  border-bottom-right-radius: 12px;
  border-bottom-left-radius: 12px;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  margin-top: 10px;
  height: 50px;
  width: 100%;
  background: rgba(255, 255, 255, 0.6);
  color: @blue;
  font-size: 16px;
  a {
    margin-bottom: 8px;
  }
  img {
    width: 40px;
    min-width: 40px;
    min-height: 40px;
    height: 40px;
    margin: 0 5px 4px 20px;
  }
}
.triangle {
  cursor: pointer;
  // background: red;
  position: absolute;
  bottom: 4px;
  right: -35px;
  width: 0;
  height: 0;
  border: 41px solid #fbfbfa;
  //   border-top-color: black;
  border-top: none;
  border-bottom-color: transparent;
  border-right-color: transparent;
}
</style>